package com.wc.AlgoOJ_train.train1.c9.光头强称砝码;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/11/2 15:51
 * @description http://43.138.190.70:8888/p/A902
 */
public class Main {
    /**
     * 奇怪的很
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int n;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            int x = (int) (Math.log(n) / Math.log(2));
            out.println(x);
            out.println("! " + x);
            int st = 1, len = n / 2;
            while (true) {
                int res = get(st, st + len, len);
                if (res == 0) {
                    out.println("! " + (st + 2 * len));
                    break;
                } else if (res == 1) st = st + len;

                len = len / 2;
            }
            out.flush();
        }
    }

    static int get(int l, int r, int len) {
        if (len == 0) return 0;
        out.println("? " + len + " " + len);
        for (int i = l; i < l + len; i++) out.print(i + " ");
        for (int i = r; i < r + len; i++) out.print(i + " ");
        out.println();
        out.flush();
        char c = sc.next().charAt(0);
        if (c == '<') return -1;
        if (c == '>') return 1;
        return 0;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}